<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>
<html>
<head>
<meta charset="UTF-8">
<title>体温监控系统</title>
<link rel="stylesheet" type="text/css" href="static/css/normalize.css">
<link rel="stylesheet" type="text/css" href="static/css/common.css">
<script type="text/javascript" src="static/js/jquery.min.js"></script>
<!-- <script src="js/common.js"></script> -->
<style>
.main {
	width: 980px;
	margin: 0px auto;
}

.roombox {
	margin: 10px 0px;
}

.roombox .title {
	
}

.roombox .bedbox li {
	border: solid 1px #ccc;
	height: 200px;
	width: 100px;
	margin: 10px 0px;
	float: left;
	width: 313px;
	height: 500px;
	margin-right: 11px;
}

.bedmoreinfo {
	width: 651px;
	height: 500px;
	border: solid 1px #ccc;
	display: none;
	position: absolute;
	background: #fff;
	border-left: none
}

#page {
	height: 100%;
	width: 100%;
	background: none;
	font-family: "微软雅黑";
	position: fixed;
	left: 0px;
	top: 0px;
	z-index: 0
}

.fr {
	float: right
}

.tab_list {
	margin: 0 auto;
	width: 964px;
	padding-right: 16px;
}

.tab_head {
	width: 964px;
	height: 40px;
	padding-right: 16px;
}

.tab_body {
	width: 964px;
	padding-right: 16px;
}

.tab_a {
	font-size: 16px;
	color: #0191ff;
	line-height: 40px;
}

.tab_b {
	font-size: 14px;
	color: #667078;
	line-height: 30px;
}

.tab_c {
	font-size: 12px;
	color: #383838;
	line-height: 40px;
}

.tab_d {
	font-size: 14px;
	color: #383838;
	line-height: 22px;
}

.add_one {
	padding: 2px 4px;
	font-size: 12px;
	color: #0191ff;
	border: 1px solid #0191ff;
	margin-top: 10px
}

.page_number {
	width: 22px;
	height: 22px;
	border: 1px solid #0191ff;
	margin-left: 8px;
	text-align: center
}

.page_number span {
	display: block;
	cursor: pointer
}

.page_gray {
	width: 22px;
	height: 22px;
	border: 1px solid #d2dde5;
	margin-left: 8px;
	text-align: center
}

.page_gray span {
	display: block;
	cursor: pointer
}

.page_ge {
	width: 964px;
	height: 40px;
	padding-right: 16px;
	margin-top: 30px;
}
</style>
<script>
	var pageSize = 15; //每页显示个数
	var nowpage = 1; //当前第几页
	var totalPages = 1;
	var autorefresh;
	function stopAutoRefresh() {
		clearTimeout(autorefresh);
	}
	function searchData() {
		autorefresh = setTimeout("initpara()", 2000);
	}
	function initpara() {
		if ($("#strmac").val().trim().length > 0) {
			//alert(window.location.href+"?strmac='"+$("#strmac").val()+"'");
			var curallurl = window.location.href.split('?');
			var cururl = curallurl[0];
			location.href = cururl + "?strmac=" + $("#strmac").val();
		} else {
			//location.reload(true);
			var curallurl = window.location.href.split('?');
			var cururl = curallurl[0];
			location.href = cururl;
		}

	}
	function GetQueryString(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
		var r = window.location.search.substr(1).match(reg);
		if (r != null)
			return unescape(r[2]);
		return null;
	}
	$(function() {
		if (GetQueryString("strmac") != null) {
			$("#strmac").val(GetQueryString("strmac"));
		}
		autorefresh = setTimeout("initpara()", 2000);
		//setTimeout("location.reload(true)", 2000);
		getListData();
	})
		function addlisten() {
			$(".pagenumbox").find(".fr").off("click")
			$(".pagenumbox").find(".fr").click(function() {
				nowpage = $(this).text();
				getListData();
			})
			$(".prevPageBt").off("click");
			$(".prevPageBt").click(function() {
				if (nowpage == 1) {
					return;
				} else {
					nowpage--;
				}
				getListData();
			})
			$(".nextPageBt").off("click");
			$(".nextPageBt").click(function() {
				if (nowpage == totalPages) {
					return;
				} else {
					nowpage++;
				}
				getListData();
			})
		}

		function delPerson() {
			$.ajax({
				type : "post",
				url : "returnTrue.json",//此处返回true或false
				dataType : "json",
				data : {},
				success : function(data) {
					$(".modelbg").hide();
					$(".confirmbox").hide();
				}
			})
		}

		function putPageNum() {
			$(".pagenumbox").empty();
			var startPage = 1;
			if (nowpage > 3) {
				if ((totalPages - nowpage) >= 2) {
					startPage = nowpage - 2;
				} else {
					startPage = nowpage - (4 - (totalPages - nowpage));
				}

			} else {
				startPage = 1;
			}
			// $(".page_ge").
			var forcount = 5;
			if (totalPages >= 5) {
				forcount = 5;
			} else {
				forcount = totalPages;
			}

			for (var i = 0; i < forcount; i++) {
				var tempPage = startPage + forcount - 1 - i;
				var tempClass = "page_gray";
				if (tempPage == nowpage) {
					tempClass = "page_number"
				} else {
					tempClass = "page_gray";
				}
				$(".pagenumbox").append(
						' <div class="'+tempClass+' fr">'
								+ '<span class="tab_d">' + tempPage + '</span>'
								+ '</div>')
			}
		}

		function getListData() {
			$.ajax({
				type : "post",
				url : "equip/list.action",//此处返回true或false
				dataType : "json",
				data : {
					"pageNo" : nowpage,
					"pageSize" : pageSize,
					"deviceNum" : $("#strmac").val()
				},
				success : function(data) {
					if (data.total % pageSize != 0) {
						totalPages = parseInt(data.total / pageSize) + 1;
					} else {
						totalPages = parseInt(data.total / pageSize);
					}
					putPageNum();
					putData(data.rows);
					$("#deviceCount").text("共" + data.total + "条数据")
				}
			})
		}

		function putData(data) {
			$(".listbox").empty();
			$(".listbox")
					.append(
							'  <tr style=" background:#e4eff7;">'
									+ '<td align="center"><span class="tab_b">序号</span></td>'
									+ '<td align="center"><span class="tab_b">设备</span></td>'
									+ '<td align="center"><span class="tab_b">消息ID</span></td>'
									+ '<td align="center"><span class="tab_b">消息长度</span></td>'
									+ '<td align="center"><span class="tab_b">消息流水号</span></td>'
									+ '<td align="center"><span class="tab_b">采集时间</span></td>'
									+ '<td align="center"><span class="tab_b">温度1</span></td>'
									+ '<td align="center"><span class="tab_b">信号强度</span></td>'
									+ '<td align="center"><span class="tab_b">电量</span></td>'
									+ '<td align="center"><span class="tab_b">效验和</span></td>'
									+ '<td align="center"><span class="tab_b">过滤数据</span></td>'
									+ '</tr>');

			$(data)
					.each(
							function(index, dom) {
								$(".listbox")
										.append(
												'  <tr style=" border-bottom:1px solid #e4ebf1;">'
														+ '<td align="center"><span class="tab_b">'
														+ dom.no
														+ '</span></td>'
														+ '<td align="center"><span class="tab_b">'
														+ dom.device
														+ '</span></td>'
														+ '<td align="center"><span class="tab_b">'
														+ dom.msgid
														+ '</span></td>'
														+ '<td align="center"><span class="tab_b">'
														+ dom.msglength
														+ '</span></td>'
														+ //+'/'+dom.age
														'<td align="center"><span class="tab_b">'
														+ dom.msgwater
														+ '</span></td>'
														+ '<td align="center"><span class="tab_b">'
														+ dom.time
														+ '</span></td>'
														+ '<td align="center"><span class="tab_b">'
														+ dom.degree1
														+ '</span></td>'
														+ '<td align="center"><span class="tab_b">'
														+ dom.degree2
														+ '</span></td>'
														+ '<td align="center"><span class="tab_b">'
														+ dom.dian
														+ '</span></td>'
														+ '<td align="center"><span class="tab_b">'
														+ dom.sum
														+ '</span></td>'

														+ '<td align="center" onclick="guolvByMac(\''
														+ dom.device
														+ '\')" deviceMac="'
														+ dom.device
														+ '"><span class="tab_b">'
														+ '过滤' + '</span></td>'

														+ '</tr>');
							});
			addlisten();
		}
	//})
	//通过mac地址过滤
	function guolvByMac(strMac) {
		alert(strMac);
		$.ajax({
			type : "post",
			url : "equip/addFilter.action",//此处返回true或false
			dataType : "json",
			data : {
				strMac : strMac
			},
			success : function(data) {
				alert("过滤成功！");
			}
		})
	}
</script>
</head>

<body>
	<div id="page" style="overflow: auto;">
		<div class="header clearfix">
			<div class="headermain clearfix">
				<div class="logo"></div>
				<div class="nav">
					<!-- <a href="degreelisten.html" >温度监控</a><a href="dossierManage.html" >档案管理</a> -->
					<a href="deviceManage.html" class="checked">设备管理</a>
				</div>
				<!--              <div class="logininfo"><span>协和医院 · 住院部</span> | <span class="loginname">王可人</span> <a href="javascript:void(0)" class="updpwdbt">修改密码</a> </div> -->
			</div>
		</div>
		<div class="tab_list">
			<div class="tab_head">
				<img src="images/nu.png"
					style="margin-bottom: -2px; margin-right: 5px;"><span
					id="deviceCount" class="tab_a">共0条数据</span>
				<!-- &nbsp&nbsp&nbsp&nbsp<span>设备号：</span><input
					type="text" id="strmac"> -->
				&nbsp&nbsp&nbsp&nbsp<span>设备号：</span><input
					onfocus="stopAutoRefresh()" type="text" id="strmac">
				<button onclick="searchData()">搜索</button>
			</div>
			<div class="tab_body">
				<table width="964" class="listbox" border="0" cellspacing="0"
					cellpadding="0">
					<tr style="background: #e4eff7;">
						<td align="center"><span class="tab_b">序号</span></td>
						<td align="center"><span class="tab_b">设备</span></td>
						<td align="center"><span class="tab_b">消息ID</span></td>
						<td align="center"><span class="tab_b">消息长度</span></td>
						<td align="center"><span class="tab_b">消息流水号</span></td>
						<td align="center"><span class="tab_b">采集时间</span></td>
						<td align="center"><span class="tab_b">温度1</span></td>
						<td align="center"><span class="tab_b">温度2</span></td>
						<td align="center"><span class="tab_b">电量</span></td>
						<td align="center"><span class="tab_b">效验和</span></td>
						<td align="center"><span class="tab_b">过滤数据</span></td>
					</tr>

				</table>
				<div class="page_ge">
					<div class="page_gray fr nextPageBt">
						<span class="tab_d">></span>
					</div>
					<div class="pagenumbox">
						<div class="page_gray fr">
							<span class="tab_d">5</span>
						</div>
						<div class="page_gray fr">
							<span class="tab_d">4</span>
						</div>
						<div class="page_gray fr">
							<span class="tab_d">3</span>
						</div>
						<div class="page_gray fr">
							<span class="tab_d">2</span>
						</div>
						<div class="page_number fr">
							<span class="tab_d">1</span>
						</div>
					</div>
					<div class="page_gray fr prevPageBt">
						<span class="tab_d"><</span>
					</div>
				</div>
			</div>
		</div>
	</div>

	<div class="modelbg"></div>
	<div class="confirmbox">
		<div class="text">确认删除吗？</div>
		<a href="javascript:void(0)" class="yes">确认</a><a
			href="javascript:void(0)" class="cancel">取消</a>
	</div>

	<div class="updpwdbox">
		<div class="text">
			<div class="title">修改密码</div>
			<table class="persontab">
				<tr>
					<td>原密码</td>
					<td><input name="oldpwd" type="password"></td>
				</tr>
				<tr>
					<td>新密码</td>
					<td><input name="newpwd" type="password"></td>
				</tr>
				<tr>
					<td>确认新密码</td>
					<td><input name="surenewpwd" type="password"></td>
				</tr>
			</table>
		</div>
		<a href="javascript:void(0)" class="" onclick="updpwd()">确认</a><a
			href="javascript:void(0)" class="" onclick="closeupdpwd()">关闭</a>
	</div>
</body>
</html>
